﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;

namespace Medianamik.Core.ImportExport
{
    //public class RecordConverter : JavaScriptConverter
    //{
    //    public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
    //    {
    //        return new Record()
    //        {
    //             NodeId = (Guid)dictionary["NodeId"],
    //             ParentNodeId = (Guid?)dictionary["ParentNodeId"],
    //             NodeTypeId = (Guid)dictionary["NodeTypeId"],
    //             Flags = (int)dictionary["Flags"],
    //             Position  = (short)dictionary["Position"]
    //        };
    //    }

    //    public override IDictionary<string, object> Serialize(object obj, JavaScriptSerializer serializer)
    //    {
    //        var record = (Record)obj;
    //        Dictionary<string, object> dico = new Dictionary<string, object>()
    //            {
    //                {"NodeId",record.NodeId },
    //                {"ParentNodeId", record.ParentNodeId },
    //                {"NodeTypeId", record.NodeTypeId },
    //                {"Flags", record.Flags  },
    //                {"Position", record.Position }
    //            };

    //        return dico;
    //    }

    //    public override IEnumerable<Type> SupportedTypes
    //    {
    //        get { return new Type[] { typeof(Record) }; }
    //    }
    //}
}
